package _interview75;

import java.util.Arrays;
import java.util.Comparator;

/**
 * 452. 用最少数量的箭引爆气球
 */
public class No452 {
    public int findMinArrowShots(int[][] points) {
        Arrays.sort(points, Comparator.comparing(o -> o[1]));
        int ans = 1;
        int end = points[0][1];
        for (int[] point : points) {
            if (point[0] > end) {
                ans++;
                end = point[1];
            }
        }
        return ans;
    }
}
